<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <style>
    h2 {
      text-align: center;
    }

    table {
      width: 700px;
      height: 90px;
      margin: 0 auto;
    }

    table,
    th,
    td {
      border: 1px solid #333;
      border-collapse: collapse;
      text-align: center;
    }
  </style>
</head>

<body>
  <h2>2020年12月消费支出</h2>

  <script>
    let balance = +prompt('请输入您的银行卡总额:')
    let water = +prompt('水费:')
    let electric = +prompt('电费:')
    let network = +prompt('网费:')
    let sum = balance - water - electric - network
    document.write(`
  <table>
    <tr>
      <th>银行卡余额</th>
      <th>水费</th>
      <th>电费</th>
      <th>网费</th>
      <th>银行卡余额</th>
    </tr>
    <tr>
      <td>${balance}元</td>
      <td>${water}元</td>
      <td>${electric}元</td>
      <td>${network}元</td>
      <td>${sum}元</td>
    </tr>
  </table>
    `)
  </script>
</body>

</html>